import matplotlib.pyplot as plt
import numpy as np

plt.figure()



# plt.subplot(2,2,1)
# plt.plot([0,1,3,5,4],[0,1,2,5,6])
#
# plt.subplot(2,2,2)
# plt.plot([0,1],[0,2])
#
# plt.subplot(223)
# plt.plot([0,1],[0,3])
#
#
# # plt.subplot(224)表示将整个图像窗口分为2行2列, 当前位置为4
# plt.subplot(224)
# # plt.plot([0,1],[0,4])
# n = 12
# X = np.arange(n)
# Y1 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n)
# Y2 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n)
# plt.bar(X, +Y1, facecolor='#FFCCCC', edgecolor='white')
# plt.bar(X, -Y2, facecolor='#6699CC', edgecolor='white')
#
# plt.show()  # 展示


# 不均匀图中图
# plt.subplot(2,1,1)
# plt.plot([0,1],[0,1])
#
# plt.subplot(2,3,4)
# plt.plot([0,1],[0,2])
#
# plt.subplot(235)
# plt.plot([0,1],[0,3])
#
# plt.subplot(236)
# plt.plot([0,1],[0,4])
#
# plt.show()  # 展示



# subplot2grid
plt.figure(figsize=(8, 6))
ax1 = plt.subplot2grid((3, 3), (0, 0), colspan=3)
ax1.plot([1, 2], [1, 2])    # 画小图
ax1.set_title('ax1_title')  # 设置小图的标题
ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2)
ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
ax4 = plt.subplot2grid((3, 3), (2, 0))
ax5 = plt.subplot2grid((3, 3), (2, 1))
ax4.scatter([1, 2], [2, 2])
ax4.set_xlabel('ax4_x')
ax4.set_ylabel('ax4_y')
plt.show()  # 展示